<?php
namespace app\common\model;


///网站表model
class WebComm extends BaseCommon
{
    ///主键id
    protected $pk = 'web_id';
    ///表名
    protected $table = 'dh_web';







    ///获取分类下网站数据
    public function getAssortWebCount($assort_id = 0){
        $assort_id = intval($assort_id);
        return $this->where("assort_id",$assort_id)->count();
    }


    ///获取网站数据详情
    public function getWebDataDetail($w_id = 0){
        $w_id = intval($w_id);
        return $this->where('web_id',$w_id)
            ->field('web_id,web_title,web_url,web_description,create_time,update_time')
            ->find();
    }


    ///获取分类下所有网站数据
    public function getDesAssortWebAllData($assort_id=0){
        $assort_id = intval($assort_id);
        return $this->where('assort_id',$assort_id)
            ->order('web_sort desc')
            ->column('web_id,web_title,web_url');
    }

    ///获取指定条数分类网站数据
    public function getAssortWebLimitData($assort_id=0,$limit=7){
        $assort_id = intval($assort_id);
        $limit = intval($limit);
        return $this->where('assort_id',$assort_id)
            ->order('web_sort desc')
            ->field('web_id,web_title,web_url')
            ->limit($limit)
            ->select();
    }


}